"""
获取配置文件
"""

import yaml
import os


class GetConf:

    @staticmethod
    def format_data():
        # print(os.getcwd())
        # print(os.path.dirname(os.path.realpath(__file__)))
        # with open(os.getcwd() + "/conf/config.yaml", "r", encoding="utf-8" ) as f:
        with open(os.path.dirname(os.path.realpath(__file__)) + "/config.yaml", "r", encoding="utf-8" ) as f:
            conf_data = yaml.load(f, Loader=yaml.FullLoader)
        return conf_data


    @classmethod
    def get_api_data(cls):
        # 获取api配置
        conf_data = cls.format_data()
        api_host = conf_data["api"]["host"]
        api_port = conf_data["api"]["port"]
        api_debug = conf_data["api"]["debug"]
        return api_host, api_port, api_debug